<template>
  <el-row>
    <Print-modal ref="PrintModal" :printHeader="printHeader" :printList="printList"></Print-modal>
    <el-col :span="24">
      <el-form label-position="left" label-width="120px">
        <Portlet class="show" title="订单信息">
          <el-col :lg="8" :md="12"  :xl="6">
            <el-form-item label="服务订单号：">
              <span>{{ model.ChMoveQueryInfoBean.founderName}}</span>
            </el-form-item>
          </el-col>
          <el-col :lg="8" :md="12"  :xl="6">
            <el-form-item label="货物来源：">
              <span>{{ model.ChMoveQueryInfoBean.foundtime | unixTimestampFilter }}</span>
            </el-form-item>
          </el-col>
        </Portlet>
        <Portlet title="移库列表">
          <div  slot="tools">
            <el-button @click.prevent="showPrint" type="warning">打印</el-button>
          </div>
            <div class="row">
              <div class="col-xs-12">
                <el-form-item label-width="0" prop="ChMoveLocationItem">
                  <el-table
                    border
                    max-height="500"
                    :data="model.ChMoveLocationItem"
                    class="text-center"
                  >
                    <el-table-column
                      prop="cargoOwnerName"
                      label="商家名称"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="locationMoveNum"
                      label="移库包件数量">
                    </el-table-column>
                    <el-table-column
                      prop="packageName"
                      label="包件名称">
                    </el-table-column>
                    <el-table-column
                      prop="packageCode"
                      label="包件编号">
                    </el-table-column>
                    <el-table-column
                      prop="productName"
                      label="所属产品">
                    </el-table-column>
                    <el-table-column
                      prop="productNo"
                      label="产品编号">
                    </el-table-column>
                    <el-table-column
                      prop="formLocationAddress"
                      label="现有库位">
                    </el-table-column>
                    <el-table-column
                      prop="toLocationAddress"
                      label="目标库位">
                    </el-table-column>
                  </el-table>
                </el-form-item>
              </div>
            </div>
        </Portlet>
      </el-form>
    </el-col>
  </el-row>
</template>
<script>
import {dotData} from '@/utils'
import PrintModal from '@/views/oms/warehouse/transfer/PrintModal'
export default {
  name: 'transferShow',
  components: {
    PrintModal
  },
  filters: {
  },
  data() {
    return {
      id: this.$route.params.id,
      loading: false,
      printHeader: {},
      printList: [],
      model: {
        ChMoveQueryInfoBean: {},
        ChMoveLocationItem: []
      }
    }
  },
  created() {
    if (this.id) {
      this.getDetail()
    }
  },
  methods: {
    getDetail() {
      this.$ajax.get('/ms-warehouse-order/moveLocation/findMoveInfo', {moveId: this.id}).then(response => {
        if (!response.data) {
          return
        }
        this.model.ChMoveQueryInfoBean = response.data || {}
        this.model.ChMoveLocationItem = response.data.chMoveLocationItemList || []
        console.log(this.model.ChMoveLocationItem)
        this.printHeader = response.data || {}
        this.printList = dotData(response, 'data.chMoveLocationItemList') || []
      })
    },
    showPrint() {
      this.$refs.PrintModal.show()
    }
  }
}
</script>
